package com.zhoug.map2lib;

import com.zhoug.common.utils.JsonUtils;
import com.zhoug.common.utils.LogUtils;

import org.osmdroid.views.overlay.Marker;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author: zhoug
 * @Date: 2024-12-31
 * @Description:
 */
public class Printer {
    private static final String TAG = ">>>Printer";

    public static <T> void print(List<T> list, ObjectToString<T> objectToString) {
        if (list != null && !list.isEmpty()) {
            List<String> str=new ArrayList<>();
            for (T item : list) {
                str.add(objectToString.toString(item));
            }
            LogUtils.d(TAG, "print:"+ JsonUtils.toJson(str));
        }
    }

    public static void printFirm(List<Firm> firms){
        Printer.print(firms, Firm::getId);
    }

    public static void printMarker(List<Marker> firms){
        Printer.print(firms, Marker::getId);
    }
}
